ROL block

Short summary

Name

ROL

→POU type

→function

Category

Standard (safe), Bitstring

Conform to →IEC-standard

(error) currently restricted
(IEC demands data type ANY_INT for the inputN and an error handling in case of values < 0 for input N.)

Graphical interface

Available since

version 1.18.0 (for Neuron Power Engineer) - initial variant

version 3.8.0 (for library Standard (safe)): block provided in this library

Functionality

The block returns the result of a bitwise rotation to the left (circular).

At input IN, enter the value to be rotated. At input N, enter the bits to left-rotate the value. The bits cleared on the one side are filled in on the other side.

Deviation from IEC-standard

If a negative value is connected to the input N, Neuron Power Engineer does not treat this as an error but performs an opposite rotation, hence a rotation to the right. This behavior is a deviation from the →IEC-standard that specifies that values < 0 for the input N are an error.

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

IN

 BOOLBYTEWORDDWORD or LWORD
(corresponds to →generic data type ANY_BIT

input value

N

INT

number of bits to rotate

Return value:

 BOOLBYTEWORDDWORD or LWORD
(corresponds to →generic data type ANY_BIT

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
    VAR
        result1 : BYTE;
        result2 : WORD;
    END_VAR
    result1 := ROL(IN := BYTE#16#42, N := 2);  (* The variable 'result1' evaluates to '16#09' (decimal: 9). *)
    result2 := ROL(IN := WORD#16#42, N := 2);  (* The variable 'result2' evaluates to '16#0108' (decimal: 264). *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.